package com.ybkj.o2o.zhuanxian.mapper;

import com.ybkj.o2o.zhuanxian.entity.Car;

import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CarMapper {

  int insert(Car record);

  Car findByEmploy(@Param("employId") Long employId, @Param("appKey") String appKey);

  int update(Car car);

  Car finByIdAndAppKey(@Param("carId") Long carId, @Param("appKey") String appKey);

  int deleteByIdAndAppKey(@Param("carId") Long carId, @Param("appKey") String appKey);

  List<Car> findByParam(@Param("lineId") Long lineId, @Param("lineName") String lineName,
      @Param("companyId") Long companyId, @Param("companyName") String companyName,
      @Param("carName") String carName, @Param("carNumber") String carNumber,
      @Param("status") Integer[] status, @Param("employId") Long employId,
      @Param("employName") String employName, @Param("limit") Integer limit,
      @Param("rows") Integer rows, @Param("appKey") String appKey);

  List<Car> findCarListByParams(@Param("lineName") String lineName, @Param("companyId") Long companyId,
                        @Param("companyName") String companyName, @Param("carNumber") String carNumber,
                        @Param("status") Integer[] status, @Param("employId") Long employId,
                        @Param("employName") String employName, @Param("limit") Integer limit,
                        @Param("rows") Integer rows, @Param("appKey") String appKey);

  Long countParam(@Param("lineId") Long lineId, @Param("lineName") String lineName,
      @Param("companyId") Long companyId, @Param("companyName") String companyName,
      @Param("carName") String carName, @Param("carNumber") String carNumber,
      @Param("status") Integer[] status, @Param("employId") Long employId,
      @Param("employName") String employName, @Param("appKey") String appKey);

  Long countParams(@Param("lineId") Long lineId, @Param("lineName") String lineName,
                  @Param("companyId") Long companyId, @Param("companyName") String companyName,
                  @Param("carName") String carName, @Param("carNumber") String carNumber,
                  @Param("status") Integer[] status, @Param("employId") Long employId,
                  @Param("employName") String employName, @Param("appKey") String appKey);

  int updateCarLineToNull(@Param("lineId") Long lineId, @Param("appKey") String appKey);

  Car findByEmployId(@Param("employId") Long employId, @Param("appKey") String appKey);

  List<Car> findBycarNumber(@Param("carNumber") String carNumber, @Param("appKey") String appKey);

  List<Car> findByIds(@Param("ids") List<Long> ids);

  Car selectByNumber(@Param("carNumber") String carNumber, @Param("appKey") String appKey);

  Car selectByCarNumber(@Param("carNumber") String carNumber, @Param("appKey") String appKey);
  
  int updateEmployIdToNull(Car car);
  
  int updateEmployIdToNullById(Car car);

}
